/**
 * @param {number[]} widths
 * @param {string} s
 * @return {number[]}
 */
 var numberOfLines = function(widths, s) {
  let o = 'a'.charCodeAt(0);
  let count = 0;
  let row = 0;
  for(let i = 0; i < s.length; i++) {
      let c = widths[s[i].charCodeAt(0) - o];
      if(row + c > 100) {
          count ++;
          row = c;
      } else {
          row += c;
      }
  }
  return [count + 1, row];
};